home *** CD-ROM | disk | FTP | other *** search
/ QuickTime for the Web (2nd Edition) / QuickTime for the Web (2nd Edition).iso / pc / AppleScript / QUICKTIME 5.0.2 SCRIPTS / Example Files / Frame Examples / Text Frame Properties < prev    next >
Encoding:
Text File  |  2001-06-26  |  6.4 KB  |  205 lines

  1. tell application "QuickTime Player"
  2.     launch
  3.     activate
  4.     stop every movie
  5.     
  6.     try
  7.         -- CHECK FOR THE CORRECT VERSION OF QUICKTIME
  8.         set the QT_version to (the QuickTime version as string)
  9.         set the player_version to (the version as string)
  10.         set the required_version to "5.0.2"
  11.         if (the QT_version is less than the required_version) or ¬
  12.             (the player_version is less than the required_version) then
  13.             set the error_message to "This script requires QuickTime " & the required_version & "  or greater." & ¬
  14.                 return & return & ¬
  15.                 "Current QuickTime Version: " & QT_version & return & ¬
  16.                 "Current QuickTime Player Version: " & player_version
  17.             my upgrade_QT(error_message)
  18.         end if
  19.         
  20.         -- CHECK FOR QUICKTIME PRO
  21.         if QuickTime Pro installed is false then
  22.             set the error_message to "This script requires a QuickTime Pro installation on this system."
  23.             my upgrade_QT(error_message)
  24.         end if
  25.         
  26.         make new movie
  27.         set this_track to make new track at movie 1 with data " "
  28.         tell movie 1
  29.             set the full text of annotation "Full Name" to "Text Frame Properties"
  30.             -- set controller type to none
  31.             tell track 1
  32.                 set dimensions to {160, 48}
  33.                 tell frame 1
  34.                     set dimensions to {160, 48}
  35.                     
  36.                     my reset_defaults("Text Frame Properties:")
  37.                     delay 1
  38.                     
  39.                     my reset_defaults("Default Font")
  40.                     repeat with this_font in {"Chicago", "Charcoal", "Courier", "Times", "Geneva"}
  41.                         set contents to ""
  42.                         set the default font to this_font
  43.                         set the default font size to 24
  44.                         set the contents to this_font
  45.                         delay 1
  46.                     end repeat
  47.                     
  48.                     my reset_defaults("Default Font Size")
  49.                     repeat with this_size in {9, 10, 12, 14, 18, 24}
  50.                         set contents to ""
  51.                         set the default font size to this_size
  52.                         set contents to ((this_size as string) & " point")
  53.                         delay 1
  54.                     end repeat
  55.                     
  56.                     my reset_defaults("Justification")
  57.                     set the justification_types to {"Left", "Center", "Right"}
  58.                     set the justification_values to {left, center, right}
  59.                     repeat with i from 1 to the count of the justification_values
  60.                         set contents to ""
  61.                         set the default font size to 18
  62.                         set the justification to item i of the justification_values
  63.                         set the contents to item i of the justification_types
  64.                         delay 1
  65.                     end repeat
  66.                     
  67.                     my reset_defaults("Foreground Color" & return & "(Text Color)")
  68.                     set the RGB_values to {{0, 0, 0}, {65535, 65535, 65535}, {65535, 0, 0}, {0, 65535, 0}, {0, 0, 65535}}
  69.                     set the RGB_names to {"Black", "White", "Red", "Green", "Blue"}
  70.                     repeat with i from 1 to the count of the RGB_values
  71.                         set the contents to ""
  72.                         set the default font size to 24
  73.                         if item i of the RGB_names is "White" then
  74.                             set the background color to {0, 0, 0}
  75.                         else
  76.                             set the background color to {65535, 65535, 65535}
  77.                         end if
  78.                         set the foreground color to item i of the RGB_values
  79.                         set the contents to item i of the RGB_names
  80.                         delay 1
  81.                     end repeat
  82.                     
  83.                     my reset_defaults("Background Color")
  84.                     set the RGB_values to {{0, 0, 0}, {65535, 65535, 65535}, {65535, 0, 0}, {0, 65535, 0}, {0, 0, 65535}}
  85.                     set the RGB_names to {"Black", "White", "Red", "Green", "Blue"}
  86.                     repeat with i from 1 to the count of the RGB_values
  87.                         set the contents to ""
  88.                         set the default font size to 24
  89.                         if item i of the RGB_names is "Black" then
  90.                             set the foreground color to {65535, 65535, 65535}
  91.                         else
  92.                             set the foreground color to {0, 0, 0}
  93.                         end if
  94.                         set the background color to item i of the RGB_values
  95.                         set the contents to item i of the RGB_names
  96.                         delay 1
  97.                     end repeat
  98.                     
  99.                     my reset_defaults("Background & Foreground")
  100.                     set the default font to "Chicago"
  101.                     set the default font size to 14
  102.                     set the foreground color to {65535, 0, 0}
  103.                     set the background color to {0, 0, 65535}
  104.                     set the contents to "Red text on Blue"
  105.                     
  106.                     my reset_defaults("")
  107.                     set the default font to "Chicago"
  108.                     set the default font size to 14
  109.                     set the foreground color to {0, 0, 65535}
  110.                     set the background color to {65535, 0, 0}
  111.                     set the contents to "Blue text on Red"
  112.                     
  113.                     my reset_defaults("")
  114.                     set the default font to "Chicago"
  115.                     set the default font size to 14
  116.                     set the foreground color to {65535, 65535, 0}
  117.                     set the background color to {0, 0, 0}
  118.                     set the contents to "Yellow text on Black"
  119.                     
  120.                     my reset_defaults("Anti-alias")
  121.                     set the default font size to 18
  122.                     set antialias to false
  123.                     set the contents to "anti-alias off"
  124.                     
  125.                     delay 1
  126.                     
  127.                     set the default font size to 18
  128.                     set antialias to true
  129.                     set the contents to "anti-alias on"
  130.                     
  131.                     my reset_defaults("Keyed Text")
  132.                     set the default font size to 18
  133.                     set keyed to false
  134.                     set the contents to "keyed text off"
  135.                     
  136.                     delay 1
  137.                     
  138.                     set the default font size to 18
  139.                     set keyed to true
  140.                     set the contents to "keyed text on"
  141.                     
  142.                     my reset_defaults("")
  143.                     
  144.                     set justification to left
  145.                     set the default font size to 24
  146.                     set y to "   "
  147.                     repeat with i in "The End"
  148.                         set y to (y & i) as string
  149.                         set contents to y
  150.                         delay 1
  151.                     end repeat
  152.                     
  153.                     my reset_defaults("")
  154.                 end tell
  155.             end tell
  156.         end tell
  157.         close movie 1 saving no
  158.     on error error_message number error_number
  159.         if the error_number is not -128 then
  160.             beep
  161.             display dialog error_message buttons {"Cancel"} default button 1
  162.         end if
  163.     end try
  164. end tell
  165.  
  166. on reset_defaults(passed_text)
  167.     delay 1
  168.     tell application "QuickTime Player"
  169.         -- activate
  170.         stop every movie
  171.         tell movie 1
  172.             tell track 1
  173.                 tell frame 1
  174.                     set contents to ""
  175.                     set keyed to false
  176.                     set antialias to false
  177.                     set the default font size to 12
  178.                     set the default font to "Geneva"
  179.                     set the background color to {65535, 65535, 65535}
  180.                     set the foreground color to {0, 0, 0}
  181.                     set the justification to center
  182.                     set the contents to the passed_text
  183.                 end tell
  184.             end tell
  185.         end tell
  186.     end tell
  187.     delay 1
  188. end reset_defaults
  189.  
  190. on upgrade_QT(passed_message)
  191.     tell application "QuickTime Player"
  192.         activate
  193.         stop every movie
  194.         set the target_URL to "http://www.apple.com/quicktime/download/"
  195.         display dialog passed_message & return & return & ¬
  196.             "If this computer is currently connected to the Internet, " & ¬
  197.             "click the “Upgrade” button to visit the QuickTime Website." buttons {"Upgrade", "Cancel"} default button 2
  198.         ignoring application responses
  199.             tell application "Finder"
  200.                 open location target_URL
  201.             end tell
  202.         end ignoring
  203.         error number -128
  204.     end tell
  205. end upgrade_QT